package cn.edu.sdjzu.knoverse.constant;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class MinioConstant {
    public static final String avatar = "avatar";
    public static final String user = "user";
    public static final String editor = "editor";
    public static final Map<String, String> typeMap = new HashMap<>();

    static {
        typeMap.put(avatar, "/avatar/");
        typeMap.put(user, "/user/");
        typeMap.put(editor, "/editor/");
    }

    public static String getType(String type) {
        String value = typeMap.get(type);
        if (value != null) return value;
        throw new RuntimeException("上传类型错误或缺失");
    }
}
